import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Line2D;
import java.awt.geom.Ellipse2D;
import javax.swing.JPanel;

public class Wizualizacja extends JPanel{
	
	double x0,y0,x1,y1,x2,y2;
	
	public Wizualizacja(double x0,double y0,double x1,double y1, double x2,double y2){
		this.x0=x0;
		this.y0=y0;
		this.x1=x1;
		this.y1=y1;
		this.x2=x2;
		this.y2=y2;
		setBackground(Color.white);
	}
	
	public void paintComponent (Graphics g) {

		super.paintComponent(g);
		Graphics2D  g2d = (Graphics2D)g;

		Line2D l1 = new Line2D.Double(); 
		l1.setLine(x0, y0, x1, y1);
		g2d.setColor(new Color(0,0,0));
		g2d.draw(l1);

		Line2D l2 = new Line2D.Double(); 
		l2.setLine(x2, y2, x1, y1);
		g2d.setColor(new Color(0,0,0));
		g2d.draw(l2);

		Ellipse2D k1 = new Ellipse2D.Double(); 
		k1.setFrame(x1-10, y1-10, 20, 20);
		g2d.setPaint(new Color(0,0,255));
		g2d.fill(k1);

		Ellipse2D k2 = new Ellipse2D.Double(); 
		k2.setFrame(x2-10, y2-10, 20, 20);
		g2d.setPaint(new Color(0,0,255));
		g2d.fill(k2);
	}

}
